package com.game.HUD;

import javax.microedition.khronos.opengles.GL10;

import object.obj2D.weapon.FireGun;
import object.obj2D.weapon.Gun;
import object.obj2D.weapon.MachineGun;
import system.Device;
import system.Graphics;

public class ShowGun extends ShowGUIItem {
	private final static int NUM_OF_GUN = 2;
	static private Gun m_curGun;
	static private int m_indexCurGun = 0;
	static private Gun[] m_gunArray;
	static private boolean isFire = false;
	static private GL10 gl;
	static private float m_fSrcHeight = 0;
	static private float m_fSrcWidth = 0;
	
	public static void Init()
	{
		m_fSrcWidth = Device.GetWidth();
		m_fSrcHeight = Device.GetHeight();
		gl = Graphics.GetGraphics();
		
		m_gunArray = new Gun[NUM_OF_GUN];
		m_gunArray[0] = new MachineGun();
		m_gunArray[1] = new FireGun();
		m_curGun = m_gunArray[(m_indexCurGun) % NUM_OF_GUN];
	}
	
	public static void Render()
	{
		gl.glMatrixMode(GL10.GL_MODELVIEW);
		gl.glPushMatrix();
		gl.glTranslatef((m_fSrcWidth - m_curGun.getWidth())/2, -(m_fSrcHeight - m_curGun.getHeight())/2, 0);
		gl.glDisable(GL10.GL_DEPTH_TEST);
		if(isFire)
		{
			m_curGun.Render(Gun.AC_FIRE);
			isFire = false;
		}
		else
		{
			m_curGun.Render(Gun.AC_STOP);
		}
		gl.glPopMatrix();
	}
	
	public static void Update()
	{
		
	}
}
